﻿using System;
using System.Collections.Generic;
using System.Text;
using DevExpress.Web.ASPxTreeList;

namespace OT.Dev
{
    public class TreeUtility
    {
        #region CreateNodeCore

        static public TreeListNode CreateNodeCore(ASPxTreeList treeList, object key, string iconName, string text, TreeListNode parentNode)
        {
            TreeListNode node = treeList.FindNodeByKeyValue(key.ToString());
            if (node == null)
            {
                node = treeList.AppendNode(key, parentNode);
                node["IconName"] = iconName;
                node["Name"] = text;
            }
            else
            {
                if (node["Name"].ToString() != text)
                    node["Name"] = text;
            }
            return node;
        }

        #endregion
    }
}
